package cn.village.service.impl;
import cn.village.dao.JunctionContractMapper;
import cn.village.entity.JunctionContract;
import cn.village.service.JunctionContractService;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Service
public class JunctionContractServiceImpl implements JunctionContractService {

    @Resource
    private JunctionContractMapper junctionContractMapper;

    public JunctionContract getJunctionContractById(String id)throws Exception{
        return junctionContractMapper.getJunctionContractById(id);
    }

    public List<JunctionContract>	getJunctionContractListByMap(Map<String,Object> param)throws Exception{
        return junctionContractMapper.getJunctionContractListByMap(param);
    }

    public Integer getJunctionContractCountByMap(Map<String,Object> param)throws Exception{
        return junctionContractMapper.getJunctionContractCountByMap(param);
    }

    public Integer qdtxAddJunctionContract(JunctionContract junctionContract)throws Exception{
            //junctionContract.setCreatedTime(new Date());
            return junctionContractMapper.insertJunctionContract(junctionContract);
    }

    public Integer qdtxModifyJunctionContract(JunctionContract junctionContract)throws Exception{
        //junctionContract.setUpdatedTime(new Date());
        return junctionContractMapper.updateJunctionContract(junctionContract);
    }

    public Integer qdtxDeleteJunctionContractById(String id)throws Exception{
        return junctionContractMapper.deleteJunctionContractById(id);
    }

    public Integer qdtxBatchDeleteJunctionContract(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return junctionContractMapper.batchDeleteJunctionContract(param);
    }


}
